package com.musicdaze.tasks;

import java.util.Date;

import com.musicdaze.Playable;
import com.musicdaze.utils.schedule.Schedule;
import com.musicdaze.utils.schedule.Task;

/**
 * Daily media plays a playable at a specific
 * time during the day every day at the same time
 * @author mfujihara
 *
 */
public class OneTimeMedia implements Task{
	/** the schedule */
	private Schedule schedule;
	/** the track to play */
	private Playable playable;
	/**
	 * Constructs the DailyMedia with the specified
	 * start date and the playable to play
	 * @param date the date to start
	 * @param play the playable to play
	 */
	public OneTimeMedia(Date date, Playable play){
		this.schedule = new Schedule();
		this.playable = play;
		schedule.setDate(date);
		schedule.setNoRepeat();
	}
	/** {@inheritDoc}*/
	@Override
	public void commence() {
		playable.play();
	}
	/** {@inheritDoc}*/
	@Override
	public void end() {
		// do nothing
	}
	/** {@inheritDoc}*/
	@Override
	public Schedule getSchedule() {
		return schedule;
	}
}
